package com.br.negocio.vo;

import java.io.Serializable;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

@Entity
@Table(name = "ServicoCompra")
@NamedQueries ({
        @NamedQuery(name = "loadAllServicoCompra", query = "from ServicoCompraVO as pc where pc.compraVO.codigo = :codigo"),
})
public class ServicoCompraVO implements Serializable {

        private static final long serialVersionUID = 1L;

        @EmbeddedId  
        private ServicoCompraPK ServicoCompraPK;
        
        @Column(name = "preco_compra")
        private float precoCompra;
        
        @Column(name = "custo_compra")
        private float custoCompra;
        
        
        @Column(name = "quantidade_comprada")
        private float quantidadeComprada;
        
        
        @JoinColumn(name="cod_compra", 
                        referencedColumnName="cod_compra",
                        nullable = false,
                        insertable=false, updatable=false)
        @ManyToOne(optional=false, fetch= FetchType.LAZY)
        @Basic(optional=false)
        @Fetch(FetchMode.JOIN)
        private CompraVO compraVO;
        
        @JoinColumn(name="cod_Servico", 
                        referencedColumnName="cod_Servico",
                        nullable = false,
                        insertable=false, updatable=false)
        @ManyToOne(optional=false, fetch= FetchType.LAZY)
        @Basic(optional=false)
        @Fetch(FetchMode.JOIN)
        private ServicoVO ServicoVO;
        
                
        public ServicoCompraVO(){
                ServicoCompraPK = new ServicoCompraPK();
                ServicoVO = new ServicoVO();
        }
        
        public ServicoCompraPK getServicoCompraPK() {
                return ServicoCompraPK;
        }

        public void setServicoCompraPK(ServicoCompraPK ServicoCompraPK) {
                this.ServicoCompraPK = ServicoCompraPK;
        }


        public float getPrecoCompra() {
                return precoCompra;
        }


        public void setPrecoCompra(float precoCompra) {
                this.precoCompra = precoCompra;
        }


        public float getQuantidadeComprada() {
                return quantidadeComprada;
        }


        public void setQuantidadeComprada(float quantidadeComprada) {
                this.quantidadeComprada = quantidadeComprada;
        }
        

        public CompraVO getCompraVO() {
                return compraVO;
        }

        public void setCompraVO(CompraVO compraVO) {
                this.compraVO = compraVO;
        }

        public ServicoVO getServicoVO() {
                return ServicoVO;
        }

        public void setServicoVO(ServicoVO ServicoVO) {
                this.ServicoVO = ServicoVO;
        }

        public float getCustoCompra() {
                return custoCompra;
        }

        public void setCustoCompra(float custoCompra) {
                this.custoCompra = custoCompra;
        }
}
